package cn.mw.cmdb.enums;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

/**
 * @Author shenwenyi
 * @Date 2024/6/4 22:45
 * @PackageName:cn.mw.cmdb.enums
 * @ClassName: WorkStateEuum
 * @Description: TODD
 * @Version 1.0
 */
@Getter
public enum WorkStateEnum {
    SUCCESS("success","已完成"),
    PROCESSING("processing","进行中"),
    EXCEED("exceed","超期"),
    PENDING("pending","未开始");

    private final String code;

    private final String desc;

    WorkStateEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static WorkStateEnum getEnum(String code){
        return Arrays.stream(WorkStateEnum.values()).filter(t->t.getCode().equals(code)).findFirst().orElseGet(null);
    }

}
